package com.dyz.leetcode._13_binaryTree;

import com.dyz.leetcode.TreeNode;

import java.util.ArrayList;
import java.util.List;

public class _145_postorderTraversal {
    private List<Integer> res = new ArrayList<>();
    public List<Integer> postorderTraversal(TreeNode root) {
        if(root==null){return res;}
        postOrder(root);
        return res;
    }
    private void postOrder(TreeNode root){
        if(root==null){
            return;
        }
        postOrder(root.left);

        postOrder(root.right);
        res.add(root.val);
    }
}
